Skip to content

feat(mesh-ops): intent-driven presets for printing, game and web - #430

Merged
lightningpixel merged 2 commits into
devfrom
feat/299-intent-presets
Nov 12, 2026
Merged

lightningpixel merged 2 commits into
devfrom
feat/299-intent-presets

Conversation

@lightningpixel

Copy link
Copy Markdown
Owner

Closes #299

What

Three new registry ops in a new presets category, each one chaining existing ops in a single call:

Preset Steps Params
prepare_for_printing repair_mesh (holes filled) → lay flat → scale in mm → drop to ground size_mm (100), dimension
prepare_for_game decimate → scale in m → recompute normals target_faces (20 000), size_m (1), dimension
prepare_for_web aggressive decimate → recompute normals target_faces (5 000)
  • Each preset writes a single output file (intermediates live in a temp dir that is removed afterwards) and returns a steps list with one summary per step, plus face_count / dimensions.
  • Each one has an AgentTool, so it becomes a chat tool automatically (T-B2 — Generate agent tools from the registry #301). The system prompt tells the model to call the preset once for these intents instead of chaining ops.
  • recompute_normals turns inside-out faces outwards first, then derives smooth vertex normals from the faces. UVs and materials are kept.

Limitations

  • The printing preset outputs geometry only (repair drops textures); the chat reply says so.
  • Not tried against a live LLM: the "one message" acceptance check is covered by the tool/prompt wiring and by tests with a mocked API.

Tests

  • New api/tests/test_mesh_ops_presets.py (11 tests): watertight + scaled + grounded print output, decimate/scale/normals chains, inside-out winding fixed, textures kept on web, one output file per run, agent tools exposed.
  • Ran end to end with the real meshoptimizer decimation on a 20k-face inside-out sphere: all three outputs have outward normals and the expected size / face count.
  • npm run test: Python 377 OK (5 skipped), Node 125 + 212 pass. npm run lint clean.

Add prepare_for_printing, prepare_for_game and prepare_for_web as registry ops in a new "presets" category. Each composes the existing ops (repair_mesh, semantic transforms, decimate) plus a normals recompute, writes a single output file and reports every step in its details. They are exposed to the chat agent, and the system prompt routes printing/game/web intents to them in one call.

Closes #299
…mp dir in presets

recompute_normals now fixes the face winding before deriving normals, so a
mesh exported inside out comes out with outward normals. The presets also
create context.temp_dir when a workflow points it at a folder that does not
exist yet.
@lightningpixel
lightningpixel merged commit 2c7d54e into dev Nov 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant